#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const long long mod=1e9+7;
long long x,y;
queue<long long> q;
unordered_map<long long,long long> s;
long long dfs(long long n)
{
	if(s[n])
	{
		return s[n];
	}
	return s[n]=((n%2==0&&n/2>=x?dfs(n/2):0)+(n-1>=x?dfs(n-1):0))%mod;
}
int main()
{
	freopen("op.in","r",stdin);
	freopen("op.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>x>>y;
	s[x]=1;
	cout<<dfs(y)<<endl;
	return 0;
}
